package com.foreknow.demo7;

public class Animal {
    String name;
    int age;
    String color;
    int leg;

    public void eat(){
        System.out.println("eat..........");
    }
    public void  sleep(){
        System.out.println("sleep........");
    }

    public static void main(String[] args) {
        //创建对象猫并调用属性方法
        Animal animal2 = new Animal();
        animal2.name = "Jerry";
        animal2.age = 5;
        animal2.color = "Brown";
        animal2.leg = 4;
        animal2.eat();
        animal2.sleep();
        //创建对象猫并调用属性方法
        Animal animal = new Animal();
        animal.name = "Tom";
        animal.age = 5;
        animal.color = "Bluish-grey";
        animal.leg = 4;
        animal.eat();
        animal.sleep();
        //创建对象狗并调用属性方法
        Animal animal1 = new Animal();
        animal1.name = "Spike";
        animal1.age = 6;
        animal1.color = "Gray";
        animal1.leg = 4;
        animal1.eat();
        animal1.sleep();
    }
}
